package com.zf.agentuse.in_running;

import com.zf.agentuse.Student;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Agent需要修改的类所在的目标JVM进程
 */
public class TargetJvmProc {
    public static void main(String[] args) throws InterruptedException {
        AtomicInteger count = new AtomicInteger(1);
        while (true) {
            TimeUnit.SECONDS.sleep(5);
            new Thread(() -> {
                System.out.printf("第 %d 次执行了目标程序\n", count.get());
                count.incrementAndGet();
                Student student = new Student();
                student.setAge(12);
                student.setName("李四");
                student.getAge();
                student.getName();
            }).start();
        }
    }
}